<!DOCTYPE html>

<html>

	<head>
		<meta charset="UTF-8">
		<title>网络学生</title>
		<script src="js/global1.js" type="text/javascript" charset="utf-8"></script>
	
		<script type="text/javascript">
		var rr=null;
		var uid=null;
		var sid=null;
		var scoid=null;
		var tt38=null;
		$(function(){
			
			init();
			showSetColumn();
			userlist();
		})
		
		function userlist(){
			$.post(globalData.pre+"/selectlist",{
			},function(res){
				 rr=res
				
			},"json")
		}
		function mokuai(){
				
				var rid=$("#rrrid").val();
				$.post(globalData.pre+"/MyModules",{
					rid:rid
				},function(res){
					   tt=res; 
					  
					  for ( i in tt){  
						if (tt[i].mid==30) {
							$("#zjxsmk" ).css("display", "block"); 
						}
						if (tt[i].mid==38) {
							tt38=tt[i].mid;
						}
				 }
				},"json")
				
				
				
			}
		

		//初始化
		function init(){
			mokuai();
			$("#zjxsmk" ).css("display", "none"); 
			var minqita = $('#minqita').datebox('getValue');  
			var maxqita = $('#maxqita').datebox('getValue');  
			$('#dg').datagrid({    
			    url:globalData.pre+'/SelectStudent2',    
			    method:"post",
			    pagination:true,
			    queryParams: {
			    	sname:$("#sname").val(),
			    	sqq:$("#sqq").val(),
			    	sphone:$("#sphone").val(),
			    	scoid:$("#scoid").val(),
			    	svis: $('#svis').combobox('getValue'),
			    	sfees: $('#sfees').combobox('getValue'),
			    	shave: $('#shave').combobox('getValue'),
			    	sreserved2: $('#qita').combobox('getValue'),
			    	minqita:minqita,
			    	maxqita:maxqita
				}
			
			}); 
			$("#ss").form("reset");
		}
		//后面的操作
		function forcaozuo(value,row,index){
			
			return "<a href='javascript:void(0)' onclick='cha("+index+")' class='easyui-linkbutton'>查看</a>"			
		}
		function forzixunshi(value,row,index){
			if (tt38==38) {
				return "<a href='javascript:void(0)' onclick='zixunshi("+index+")' class='easyui-linkbutton'>分配咨询师</a>"					
			}else{
				return "未授权"
			}
			
		}
		function zixunshi(index){
			var data = $("#dg").datagrid("getData");
			var row = data.rows[index];
			sid=row.sid;
			$('#zixunshi').window('open'); 
			initt()
		}
		function initt(){
			$('#sys').datagrid({    
			    url:'selectzixunshi',
			    singleSelect:true,  
			    onSelect: function(index,row){
					var data=$("#sys").datagrid("getData");
					scoid = data.rows[index].uid;
		        },
			    columns:[[       
			        {field:'uid',title:'咨询师id'} ,
			        {field:'uname',title:'咨询师名称'} 
			    ]]    
			});   
		}
		function zengjia(){
					$.post(globalData.pre+"/updateStudent",{
						scoid:scoid,
						sid:sid,
						sdtuname:$("#sdtuname").val(),
						stianjia:'给你分配了一位学生',
					},function(res){
						if (res>0) {
							alert("添加咨询师成功")
							init()
						}else{
							alert("添加咨询师失败，请刷新后再试一下")
							init()
						}
					},"json")
		}
		function cha(index){
			var data = $("#dg").datagrid("getData");
			var row = data.rows[index];
			$("#ssex").combo("setText",row.sreport);
			$("#sreport").combo("setText",row.sreport);
			$("#sxueli").combo("setText",row.sxueli);
			$("#sstate").combo("setText",row.sstate);
			$("#schannel").combo("setText",row.schannel);
			$("#swebsite").combo("setText",row.swebsite);
			$("#xg").form("load",row);
			$('#upddiv').window('open'); 
		}
		function quxiao1(){
			$('#upddiv').window('close'); 
		}
		function jia(index) {
			var data = $("#dg").datagrid("getData");
			var row = data.rows[index];
			$("#tianjia").form("load", row);
			$('#insertdiv').window('open');
		}
		//增加保存
		function getDateTimeStr() {
			var s = "";
			var d = new Date();
			s += d.getFullYear() + "/";
			s += (d.getMonth() + 1) + "/";
			s += d.getDate() + " ";
			var c = ":";
			s += d.getHours() + c;
			s += d.getMinutes() + c;
			s += d.getSeconds();
			return s;
		}

		function baocun2() {
			$.post(globalData.pre+"/insertJournal", {
				jdate : getDateTimeStr(),
				jstid : $("#jstid").val(),
				jusid : $("#uid").val(),
				jvisdate : $("#jvisdate1").val(),
				jreview : $("#jreview1").val(),
				jtali : $("#jtali1").val(),
				jnextdate : $("#jnextdate1").val(),
				jremark : $("#jremark1").val(),
		    	
			}, function(res) {
				if (res > 0) {
					alert("增加成功");
					$('#insertdiv').window('close');
					init();
				} else {
					alert("增加失败");
					init();
				}
			}, "json") }
		//增加取消
		function quxiao2() {
			$('#insertdiv').window('close');
		}
		function forsex(value,row,index){
			return value==1?"男":"女";
		}
		//把1和0变成是否
		function forsfees(value,row,index){
			return value==1?"是":"否";
		}
		function foruserid(value,row,index){
			for ( i in rr){  
				if (rr[i].uid==value) {
					return 	rr[i].uname; 
				}
			 }
			return value
		}
		//打开增加面板
		function inse(){
			$('#adddiv').window('open');
		}
		//增加保存
		function baocun(){
			var uid=globalData.getCurUid();
			var sname=$("#sname1").val();
			var sphone=$("#sphone1").val();
			var sesdate=getDateTimeStr();
			if (sname!=null&&sname!=''&&sphone!=null&&sphone!='') {
				$.post(globalData.pre+"/insertStudent",{
					sname:sname,
					ssex: $('#ssex1').combobox('getValue'),
					sxueli:$("#sxueli1").combobox('getValue'),
					sqq:$("#sqq1").val(),
					swechat:$("#swechat1").val(),
					sphone:sphone,
					senid:uid,
					sstate:$("#sstate1").combobox('getValue'),
					schanne:$("#schannel1").combobox('getValue'),
					santistop:$("#santistop1").val(),
					swebsite:$("#swebsite1").combobox('getValue'),
					sreport: $('#sreport1').combobox('getValue'),
					sremark:$("#sremark1").val(),
					sesdate:sesdate,
				},function(res){
					if (res>0) {
						alert("增加成功");
						$('#adddiv').window('close');
						init();
					}else{
						alert("增加失败");
						init();
					}
				},"json")
			} else if(sname==null&&sname==''&&sphone!=null&&sphone!=''){
				alert("学生姓名不可为空")
			}else if (sname!=null&&sname!=''&&sphone==null&&sphone==''){
				alert("学生手机号不可为空")
			}else{
				alert("学生姓名和手机号不可为空")
			}
				
				
			}
		//增加取消
		function quxiao(){
				$('#adddiv').window('close'); 
			}
		

			function shezhi(){
				$("#showColumn").window("open");
				$("#dg").datagrid("reload");
			}
			//设置需要显示的例
			function showSetColumn(){
				$("#disColumn").find("input[name=check]").change(function(res) {
					if (this.checked == true) {
						$("#dg").datagrid("showColumn", this.value);
					} else {
						$("#dg").datagrid("hideColumn", this.value);
					}
				});
			}
			//全选
			function allChecked() {
				$("#disColumn").find("input").prop("checked",$("#allChecked").prop("checked"));
				var len = $("#disColumn").find("input[name=check]").length;
				for (var i = 0; i < len; i++) {
					$("#disColumn").find("input[name=check]").eq(i).change();//绑定change事件
				}
			}
			function zidongfenpei(){
				$.post(globalData.pre+"/studentzidongfenpei",{
					
				},function(res){
					if (res>0) {
						alert("自动分配完成")
						init();
					} else {
						alert("自动分配失败")
					}
				},"json")
			}
		</script>
	</head>
	
	<body>
		<form id="ss">
			<label > 姓名关键字:</label>   
	        <input class="easyui-validatebox" type="text"  id="sname"/>   
	        <label >电话:</label>   
	        <input class="easyui-validatebox" type="text"  id="sphone" />  
	        <label>咨询师:</label>   
	        <input class="easyui-validatebox" type="text"  id="scoid"/> 
	        <br/>
	        <label >是否缴费:</label>   
	        <select id="sfees" class="easyui-combobox"  style="width:173px;"> 
	       		<option value="">---请选择---</option>
			    <option value="1">是</option>   
			    <option value="0">否</option>   
			</select>
			
			<label >是否有效:</label>  
			 <select id="shave" class="easyui-combobox"  style="width:173px;"> 
	       		<option value="">---请选择---</option>
			    <option value="1">是</option>   
			    <option value="0">否</option>   
			</select>
			<label >是否回访:</label>  
			 <select id="svis" class="easyui-combobox"  style="width:173px;"> 
	       		<option value="0">---请选择---</option>
			    <option value="0">是</option>   
			    <option value="1">否</option>   
			</select>
			<br/>
	        <label>QQ:</label>   
	        <input class="easyui-validatebox" type="text"  id="sqq"/>   
	        
	        
	        <select id="qita" class="easyui-combobox" style="width:100px;">  
	        	<option value="">---请选择---</option>   
			    <option value="sesdate">创建时间</option>   
			    <option value="svisitdate">上门时间</option>   
			    <option value="sfirstdate">首次回访时间</option>   
			    <option value="spay">缴费时间</option>   
			    <option value="scldate">进班时间</option>   
			</select>
			<label>:</label>   
	        <input  id="minqita"  type= "text" class= "easyui-datebox" required ="required"> </input>  
	        <label>~</label>   
	        <input  id="maxqita"   type= "text" class= "easyui-datebox" required ="required"> </input>  
			<br>
			<div id="sfzdfp">  
			 <a  href="javascript:void(0)" plsin="true" onclick="zidongfenpei()" class="easyui-linkbutton">一键分配学生</a>
			</div>
			<a id="btn" href="javascript:void(0)" onclick="init()" class="easyui-linkbutton" data-options="iconCls:'icon-search'">搜索</a>  
		<a href="javascript:void(0);" id="btnExport" class="easyui-linkbutton" iconCls='icon-print'>导出Excel</a>
			<a id="daoru1" href="javascript:void(0)" plsin="true" onclick="shezhi()" class="easyui-linkbutton" data-options="iconCls:'icon-add'">选择列</a>  
		
		<div id="zjxsmk"><a id="add" href="javascript:void(0)" onclick="inse()" class="easyui-linkbutton" data-options="iconCls:'icon-add'">增加</a>  </div>	
			
	</form>
	
		<table id="dg" class="easyui-datagrid">   
		     <thead>   
		        <tr>   
		            <th data-options="field:'',checkbox:true">多选</th>  
		             
		            <th data-options="field:'sid'">编码</th>   
		            <th data-options="field:'sname'">姓名</th>   
		            <th data-options="field:'sage'">年龄</th>   
		            <th data-options="field:'ssex',formatter:forsex">性别</th>   
		            <th data-options="field:'sxueli'">学历</th>   
		            <th data-options="field:'sqq'">qq号</th>   
		            <th data-options="field:'swechat',hidden:true">微信</th>   
		            <th data-options="field:'sphone'">手机号</th>   
		            <th data-options="field:'sstate'">状态</th>   
		            <th data-options="field:'sgrade',hidden:true">打分</th>   
		            <th data-options="field:'scourse'">课程方向</th>   
		            <th data-options="field:'schannel'">来源渠道</th>   
		            <th data-options="field:'santistop',hidden:true">来源关键词</th>   
		            <th data-options="field:'scoid',hidden:true">咨询师id</th>   
		            <th data-options="field:'swciid',hidden:true,formatter:foruserid">网络咨询师id</th>   
		            <th data-options="field:'scoremark',hidden:true">咨询师备注</th>   
		            <th data-options="field:'senid',hidden:true,formatter:foruserid">录入人id</th>   
		            <th data-options="field:'svalid',hidden:true,formatter:forsfees">是否有效</th>   
		            <th data-options="field:'svisit',hidden:true,formatter:forsfees">是否回访</th>   
		            <th data-options="field:'sesdate',hidden:true">创建时间</th>   
		            <th data-options="field:'svisitdate',hidden:true">上门时间</th>   
		            <th data-options="field:'svis',hidden:true,formatter:forsfees">是否回访</th>     
		            <th data-options="field:'sfirstdate'">首次回访时间</th>   
		            <th data-options="field:'sfees',width:60,formatter:forsfees">是否缴费</th>  
		            <th data-options="field:'smoney',hidden:true">缴费金额</th>    
		            <th data-options="field:'shave',hidden:true">是否有效</th>    
		            <th data-options="field:'scause',hidden:true">无效原因</th>    
		            <th data-options="field:'sreport',hidden:true">是否报备</th>    
		            <th data-options="field:'sremark',hidden:true">在线备注</th>    
		            <th data-options="field:'spay',hidden:true">缴费时间</th>    
		            <th data-options="field:'sclass',hidden:true,formatter:forsfees">是否进班</th>    
		            <th data-options="field:'scldate',hidden:true">进班时间</th>    
		            <th data-options="field:'sclmark',hidden:true">进班备注</th>    
		            <th data-options="field:'sattention',hidden:true">学生关注</th>    
		            <th data-options="field:'spremium',hidden:true,formatter:forsfees">是否退费</th>    
		            <th data-options="field:'spre',hidden:true">退费原因</th>    
		            <th data-options="field:'seamoney',hidden:true">定金金额</th>    
		            <th data-options="field:'seadate',hidden:true">定金时间</th>   
		            <th data-options="field:'caozuo',formatter:forcaozuo">查看</th>       
		            <th data-options="field:'zixunshi',formatter:forzixunshi">分配咨询师</th>       
		        </tr>   
		    </thead>   
		</table>  	
		
		<input class="easyui-validatebox" type="hidden" value="${list.roles.rid}"  id="rrrid"/>
		<div id="adddiv" class="easyui-window" style="width:350px;height:400px" title="增加面板" data-options="iconCls:'icon-save',modal:true,closable:true,closed:true">  
			<form id="zj" method="post">   
			<table>
				<tr>
			
					<td>
						<label >姓名:</label>
					</td>
					<td> 
						<input class="easyui-validatebox" type="text"  id="sname1" />
					</td>
				</tr>
				<tr>
					<td>
						<label >性别:</label>   
					</td>
					<td>
						
						<select id="ssex1" class="easyui-combobox"  style="width:173px;">   
						    <option value=" ">---请选择---</option>   
						    <option value="1">男</option>   
						    <option value="0">女</option>   
						</select>
					</td>
				</tr>
				<tr>
					<td>
						<label >电话:</label>
					</td>
					<td>
						<input class="easyui-validatebox" type="text"  id="sphone1"/>
						
					</td>
				</tr>
				<tr>
					<td>
						<label >学历:</label>
					</td>
					<td>
						<select id="sxueli1" class="easyui-combobox"  style="width:173px;">   
						      
						    <option value="未知">未知</option>   
						    <option value="本科">本科</option>   
						    <option value="大专">大专</option>   
						    <option value="高中">高中</option>   
						    <option value="中专">中专</option>   
						    <option value="初中">初中</option>   
						    <option value="其它">其它</option>   
						</select>
					</td>
				</tr>
				<tr>
					<td>
						<label >状态:</label>
					</td>
					<td>
						<select id="sstate1" class="easyui-combobox"  style="width:173px;">   
						      
						    <option value="未知">未知</option>   
						    <option value="待业">待业</option>   
						    <option value="在职">在职</option>   
						    <option value="在读">在读</option>   
						</select>
					</td>
				</tr>
				<tr>
					<td>
						<label >来源渠道:</label>
					</td>
					<td>
						<select id="schannel1" class="easyui-combobox"  style="width:173px;">   
						      
						    <option value="未知">未知</option>   
						    <option value="百度">百度</option>   
						    <option value="百度移动端">百度移动端</option>   
						    <option value="360">360</option>   
						    <option value="360移动端">360移动端</option>   
						    <option value="搜狗">搜狗</option>   
						    <option value="搜狗移动端">搜狗移动端</option>   
						    <option value="UC移动端">UC移动端</option>   
						    <option value="直接输入">直接输入</option>   
						    <option value="自然流量">自然流量</option>   
						    <option value="直电">直电</option>   
						    <option value="微信">微信</option>   
						    <option value="QQ">QQ</option>   
						</select>
					</td>
				</tr>
				<tr>
					<td>
						<label >来源网站:</label>
					</td>
					<td>
						<select id="swebsite1" class="easyui-combobox"  style="width:173px;">   
						      
						    <option value="其它">其它</option>   
						    <option value="职英B站">职英B站</option>   
						    <option value="高考站">高考站</option>   
						    <option value="职英A站">职英A站</option>   
						</select>
					</td>
				</tr>
				<tr>
					<td>
						<label >来源关键词:</label>
					</td>
					<td>
						<input class="easyui-validatebox" type="text"  id="santistop1"/>
						
					</td>
				</tr>
				<tr>
					<td>
						<label >学员QQ:</label>
					</td>
					<td>
						<input class="easyui-validatebox" type="text"  id="sqq1"/>
						
					</td>
				</tr>
				<tr>
					<td>
						<label >微信号:</label>
					</td>
					<td>
						<input class="easyui-validatebox" type="text"  id="swechat1"/>
						
					</td>
				</tr>
				
				<tr>
					<td>
						<label >是否报备:</label>
					</td>
					<td>
						<select id="sreport1" class="easyui-combobox" style="width:173px;">  
				        	<option value="">---请选择---</option>   
						    	 <option value="1">是</option> 
						    	 <option value="0">否</option> 
						</select>
					</td>
				</tr>
				<tr>
					<td>
						<label >在线备注:</label>
					</td>
					<td>
						<input class="easyui-validatebox" type="text"  id="sremark1"/>
						
					</td>
				</tr>
				<tr>
					
					<td>
				</td>
					<td>
					<a href="javascript:void(0)" onclick="baocun()" class="easyui-linkbutton" >确定</a>
					
					
					<a href="javascript:void(0)" onclick="quxiao()" class="easyui-linkbutton" >取消</a>
					</td>
				</tr>
			</table>
		</form> 
	</div>
	<div id="zixunshi" class="easyui-window" style="width: 350px; height: 400px" title="增加咨询师" data-options="iconCls:'icon-save',modal:true,closable:true,closed:true">
		<form id="zxs">
			<table style="width: 200px; " id="sys">  </table>  
		</form>
				
			<a href="javascript:void(0)"   onclick="zengjia()"class="easyui-linkbutton">分配给该咨询师</a>
				
	</div>
	
	
		<div id="showColumn" class="easyui-window" title="要显示的列"  	data-options="iconCls:'icon-add',minimizable:false,closed:true" style="padding:10px;min-width:500px">
		  <fieldset>
				<legend>要显示的列</legend>
			   <table id="disColumn">
				<tr>
						   <td colspan="4"><input type="checkbox" name="allChecked" id="allChecked" onchange="allChecked()" />全选</td>
						</tr>
						<tr>
						    <td><input type="checkbox" name="check" value="sid" checked="checked" />编码</td>
							<td><input type="checkbox" name="check" value="sname" checked="checked" />姓名</td>
							<td><input type="checkbox" name="check" value="sage" checked="checked" />年龄</td> 
							<td><input type="checkbox" name="check" value="ssex" checked="checked" />性别</td>
							<td><input type="checkbox" name="check" value="sxueli" checked="checked" />学历</td>
						</tr>
						<tr>
							<td><input type="checkbox" name="check" value="sqq" checked="checked" />qq号</td>
							<td><input type="checkbox" name="check" value="swechat" />微信</td> 
							<td><input type="checkbox" name="check" value="sphone" checked="checked" />手机号</td>
							<td><input type="checkbox" name="check" value="sstate" checked="checked" />状态</td>
							<td><input type="checkbox" name="check" value="sgrade" />打分</td>
						</tr>
						<tr>
						    <td><input type="checkbox" name="check" value="scourse"  />课程方向</td>
							<td><input type="checkbox" name="check" value="schannel"  />来源渠道</td>
							<td><input type="checkbox" name="check" value="santistop" />来源关键词</td>
							<td><input type="checkbox" name="check" value="scoid"  />咨询师id</td>
							<td><input type="checkbox" name="check" value="swciid"  />网络咨询师id</td>
						</tr>
						<tr>
						    <td><input type="checkbox" name="check" value="scoremark" />咨询师备注</td>
						    <td><input type="checkbox" name="check" value="senid" />录入人id</td>
						    <td><input type="checkbox" name="check" value="svalid"  />是否有效</td>
						    <td><input type="checkbox" name="check" value="svisit" />是否回访</td> 
						    <td><input type="checkbox" name="check" value="sesdate"  />创建时间</td>
						</tr>
						<tr>
						    <td><input type="checkbox" name="check" value="svisitdate" />上门时间</td>
						    <td><input type="checkbox" name="check" value="svis" />是否回访</td>
						    <td><input type="checkbox" name="check" value="sfirstdate" checked="checked"  />首次回访时间</td>
						    <td><input type="checkbox" name="check" value="sfees" />是否缴费</td>
						    <td><input type="checkbox" name="check" value="smoney"  />缴费金额</td>
						</tr>
						<tr>
					        <td><input type="checkbox" name="check" value="shave"    />是否有效</td>
					        <td><input type="checkbox" name="check" value="scausev"  />无效原因</td>
					        <td><input type="checkbox" name="check" value="sreport" />是否报备</td>
					        <td><input type="checkbox" name="check" value="sremark" />在线备注</td>
					        <td><input type="checkbox" name="check" value="spay" />缴费时间</td>
						</tr>
					    <tr>
					        <td><input type="checkbox" name="check" value="sclass" />是否进班</td>
					        <td><input type="checkbox" name="check" value="scldate" />进班时间</td>
					        <td><input type="checkbox" name="check" value="sclmark"   />进班备注</td>
					        <td><input type="checkbox" name="check" value="sattention"   />学生关注</td>
					        <td><input type="checkbox" name="check" value="spremium"   />是否退费</td>
					    </tr>
					     <tr>
					        <td><input type="checkbox" name="check" value="spre" />退费原因</td>
					        <td><input type="checkbox" name="check" value="seamoney" />定金金额</td>
					        <td><input type="checkbox" name="check" value="seadate" />定金时间</td>
					        <td><input type="checkbox" name="check" value="caozuo" />操作</td>
					    </tr>
			 </table>
		  </fieldset>
		</div>
	
	<input class="easyui-validatebox" disabled="disabled" type="hidden"  id="sdtuname" value="${list.uname}"/>
	<div id="insertdiv" class="easyui-window"
		style="width: 350px; height: 400px" title="增加面板"
		data-options="iconCls:'icon-save',modal:true,closable:true,closed:true">
		<form id="tianjia" method="post">
			<table>
				<tr>
					<td><label>学生编号:</label></td>
					<td><input class="easyui-validatebox" disabled="disabled"
						type="text" id="jstid" name="sid" /></td>
				</tr>
				<tr>
					<td><label>咨询师编号:</label></td>
					<td><input class="easyui-validatebox" disabled="disabled"
						type="text" id="uid" value="${list.uid }" /></td>
				</tr>
				<tr>

					<td><label>回访时间:</label></td>
					<td><input class="easyui-validatebox" type="text"
						id="jvisdate1" /></td>
				</tr>
				<tr>

					<td><label>回访情况:</label></td>
					<td><input class="easyui-validatebox" type="text"
						id="jreview1" /></td>
				</tr>
				<tr>

					<td><label>跟踪方式:</label></td>
					<td><input class="easyui-validatebox" type="text" id="jtali1" />
					</td>
				</tr>
				<tr>

					<td><label>下次跟踪时间:</label></td>
					<td><input class="easyui-validatebox" type="text"
						id="jnextdate1" /></td>
				</tr>
				<tr>

					<td><label>备注:</label></td>
					<td><input class="easyui-validatebox" type="text"
						id="jremark1" /></td>
				</tr>
				<tr>

					<td></td>
					<td><a href="javascript:void(0)" onclick="baocun2()"
						class="easyui-linkbutton">确定 </a> <a href="javascript:void(0)"
						onclick="quxiao2()" class="easyui-linkbutton">取消 </a></td>
				</tr>
			</table>

		</form>
	</div>
	
	<div id="upddiv" class="easyui-window" style="width:350px;height:400px" title="详细信息" data-options="iconCls:'icon-save',modal:true,closable:true,closed:true">  
			<form id="xg" method="post">   
			<table>
			<tr>
			
					<td>
						<label >编号:</label>
					</td>
					<td> 
						<input class="easyui-validatebox" disabled="disabled" type="text" name="sid"  id="sid" />
					</td>
				</tr>
				<tr>
			
					<td>
						<label >姓名:</label>
					</td>
					<td> 
						<input class="easyui-validatebox" disabled="disabled" type="text" name="sname"  id="sname" />
					</td>
				</tr>
				<tr>
					<td>
						<label >性别:</label>   
					</td>
					<td>
						
						<select id="ssex" class="easyui-combobox"  disabled="disabled"  name="ssex" style="width:173px;">   
						    <option value=" ">---请选择---</option>   
						    <option value="1">男</option>   
						    <option value="0">女</option>   
						</select>
					</td>
				</tr>
				<tr>
					<td>
						<label >电话:</label>
					</td>
					<td>
						<input class="easyui-validatebox" type="text" disabled="disabled" name="sphone"  id="sphone"/>
						
					</td>
				</tr>
				<tr>
					<td>
						<label >学历:</label>
					</td>
					<td>
						<select id="sxueli" name="sxueli" disabled="disabled"  class="easyui-combobox"  style="width:173px;">   
						      
						    <option value="未知">未知</option>   
						    <option value="本科">本科</option>   
						    <option value="大专">大专</option>   
						    <option value="高中">高中</option>   
						    <option value="中专">中专</option>   
						    <option value="初中">初中</option>   
						    <option value="其它">其它</option>   
						</select>
					</td>
				</tr>
				<tr>
					<td>
						<label >状态:</label>
					</td>
					<td>
						<select id="sstate" name="sstate" disabled="disabled"  class="easyui-combobox"  style="width:173px;">   
						      
						    <option value="未知">未知</option>   
						    <option value="待业">待业</option>   
						    <option value="在职">在职</option>   
						    <option value="在读">在读</option>   
						</select>
					</td>
				</tr>
				<tr>
					<td>
						<label >来源渠道:</label>
					</td>
					<td>
						<select id="schannel" name="schannel" disabled="disabled"  class="easyui-combobox"  style="width:173px;">   
						      
						    <option value="未知">未知</option>   
						    <option value="百度">百度</option>   
						    <option value="百度移动端">百度移动端</option>   
						    <option value="360">360</option>   
						    <option value="360移动端">360移动端</option>   
						    <option value="搜狗">搜狗</option>   
						    <option value="搜狗移动端">搜狗移动端</option>   
						    <option value="UC移动端">UC移动端</option>   
						    <option value="直接输入">直接输入</option>   
						    <option value="自然流量">自然流量</option>   
						    <option value="直电">直电</option>   
						    <option value="微信">微信</option>   
						    <option value="QQ">QQ</option>   
						</select>
					</td>
				</tr>
				<tr>
					<td>
						<label >来源网站:</label>
					</td>
					<td>
						<select id="swebsite" name="swebsite" disabled="disabled"  class="easyui-combobox"  style="width:173px;">   
						      
						    <option value="其它">其它</option>   
						    <option value="职英B站">职英B站</option>   
						    <option value="高考站">高考站</option>   
						    <option value="职英A站">职英A站</option>   
						</select>
					</td>
				</tr>
				<tr>
					<td>
						<label >来源关键词:</label>
					</td>
					<td>
						<input class="easyui-validatebox" disabled="disabled"  type="text" name="santistop" id="santistop"/>
						
					</td>
				</tr>
				<tr>
					<td>
						<label >学员QQ:</label>
					</td>
					<td>
						<input class="easyui-validatebox" disabled="disabled"  type="text" name="sqq" id="sqq"/>
						
					</td>
				</tr>
				<tr>
					<td>
						<label >微信号:</label>
					</td>
					<td>
						<input class="easyui-validatebox" disabled="disabled"  type="text" name="swechat" id="swechat"/>
						
					</td>
				</tr>
				
				<tr>
					<td>
						<label >是否报备:</label>
					</td>
					<td>
						<select id="sreport" disabled="disabled"  class="easyui-combobox" name="sreport" style="width:173px;">  
				        	<option value="">---请选择---</option>   
						    	 <option value="1">是</option> 
						    	 <option value="0">否</option> 
						</select>
					</td>
				</tr>
				<tr>
					<td>
						<label >在线备注:</label>
					</td>
					<td>
						<input class="easyui-validatebox" disabled="disabled"  type="text" name="sremark" id="sremark"/>
						
					</td>
				</tr>
				<tr>
					
					<td>
				</td>
					<td>
					
					<a href="javascript:void(0)" onclick="quxiao1()" class="easyui-linkbutton" >确定</a>
					</td>
				</tr>
			</table>
		</form> 
	</div>
	
	</body>
<script type="text/javascript">
function JSONToCSVConvertor(JSONData, ReportTitle, ShowLabel){
	//如果jsondata不是对象，那么json.parse将分析对象中的json字符串。
	var arrData = typeof JSONData != 'object' ? JSON.parse(JSONData) : JSONData;
	var CSV = '';

	//在第一行拼接标题
	CSV += ReportTitle + '\r\n\n';

	//产生数据标头
	if (ShowLabel) {
		var row = "";
		//此循环将从数组的第一个索引中提取标签
		for ( var index in arrData[0]) {

			//现在将每个值转换为字符串和逗号分隔
			row += index + ',';
		}

		row = row.slice(0, -1);

		//添加带换行符的标签行
		CSV += row + '\r\n';
	}

	//第一个循环是提取每一行
	for (var i = 0; i < arrData.length; i++) {
		var row = "";

		//2nd loop will extract each column and convert it in string comma-seprated
		for ( var index in arrData[i]) {
			row += '"' + arrData[i][index] + '",';
		}

		row.slice(0, row.length - 1);

		//add a line break after each row
		CSV += row + '\r\n';
	}

	if (CSV == '') {
		alert("Invalid data");
		return;
	}

	//Generate a file name
	var fileName = "我的学生_";
	//this will remove the blank-spaces from the title and replace it with an underscore
	fileName += ReportTitle.replace(/ /g, "_");

	//Initialize file format you want csv or xls
	//var uri = 'data:text/csv;charset=utf-8,' + escape(CSV);
	var uri = 'data:text/csv;charset=utf-8,\ufeff' + encodeURI(CSV);

	// Now the little tricky part.
	// you can use either>> window.open(uri);
	// but this will not work in some browsers
	// or you will not get the correct file extension    

	//this trick will generate a temp <a /> tag
	var link = document.createElement("a");
	link.href = uri;

	//set the visibility hidden so it will not effect on your web-layout
	link.style = "visibility:hidden";
	link.download = fileName + ".csv";

	//this part will append the anchor tag and remove it after automatic click
	document.body.appendChild(link);
	link.click();
	document.body.removeChild(link);
}
/**
 * 选择ID增加单击时间执行方法
 */
$("#btnExport").click(function() {
	var rows=$('#dg').datagrid('getSelections');
	if(rows.length==0){
		$.messager.alert("系统信息","请选择你要导出的数据");
		return ;
	}
	//导出所有
	/* var data = JSON.stringify($('#booTab').datagrid('getData').rows); */
	var data=JSON.stringify(rows);
	if (data == '')
		return;

	JSONToCSVConvertor(data, "数据信息", true);
});
</script>





</html>